<template>
  <div class="ali-pay">
    <div class="form" v-html="content">2</div>
    <Loading />
  </div>
</template>

<script>
import requests from "@/api/ajax";
export default {
  name: "AliPay",

  data() {
    return {
      orderId: this.$route.query.orderId,
      content: "",
    };
  },

  mounted() {this.paySubmit()},

  methods: {
    paySubmit() {
      requests
        .post("/pay", {
          orderId: this.orderId,
          orderName: "Vue高仿小米商城",
          amount: 0.01,
          payType: 1,
        })
        .then((res) => {
            this.content=res.data.content;
            // 设置渲染时间，表单的第一个 // <script>document.getElementById('bestPayForm').submit()
           
            setTimeout(()=>{
                 document.forms[0].submit()
            },100)
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
